object worksheet_chengfang {
  val l1 = List("alice", "bob", "cathy")

  for (s <- l1) //循环遍历l1里面的元素
    println(s)

  for {
    s <- l1
    if (s.length > 3)
  } println(s)

  val result_for = for {
    s <- l1
    s1 = s.toUpperCase();
    if (s1 != "")
  } yield (s1)//yield会把s1放进result_for里面

  def main(args: Array[String]): Unit = {
    println(result_for)
  }
}


